define(['app'],function(app){return {module: function($scope, $http, eventBusService, httpService, params) {

	//查询课表方案
	$scope.find = function(){
		httpService.post(app.urls.findScheduleListURL, {},function(data){
			if("0000" === data.code){
				$scope.rows = data.data;
			}else{
				alert(data.msg);
			}
		});
	}
	$scope.find();

	//按钮点击事件-条件查询
	$scope.select = function(){
    	$scope.page.current = 1;
    	$scope.find();
    }

	/**
	 * 新建课表方案
	 */
	$scope.add = function(){
        eventBusService.publish("modal.alert",{"content":"是否确认新建一个课表方案？","isAutoClose":false,"confirm":function(){
			httpService.post(app.urls.addSourceDataPostURL, {},function(data){
				if("0000" === data.code){
                    eventBusService.publish("modal.alert",{"content":"课表方案新建成功！"});
				}else{
					alert(data.msg);
				}
			});
		},"cancel":function(){
			//用户取消，不做操作
		}});
	}

	/**
	 * 切换方案
	 * @param row
	 */
	$scope.changeScheme = function(row){
		console.log(row);
        eventBusService.publish("modal.alert",{"content":"是否确认切换课表方案？","isAutoClose":false,"confirm":function(){
			httpService.post(app.urls.addScheduleGetURL, {TSJWID: row.TSJWID},function(data){
				if("0000" === data.code){
					eventBusService.publish("modal.alert",{"content":"切换成功！"});
				}else{
					alert(data.msg);
				}
			});
		},"cancel":function(){
			//用户取消，不做操作
		}});
	}

	$scope.saveForm = function(){
	}
	
}}});